package com.ra.landlord;

import java.math.BigDecimal;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.googlecode.cswish.annotation.cm;

/**
 * 
 * @author liuZhenghua
 * @date 2015年8月3日 下午8:00:31
 * @version 1.0
 * @since
 */
@Entity
public class SubRoom {
	
	@cm("男")
	public static final Integer SEX_MALE = 0;
	@cm("女")
	public static final Integer SEX_FEMALE = 1;
	@cm("性别无要求")
	public static final Integer SEX_UNLIMITED = 2;
	
	@cm("主卧")
	public static final Integer ROOM_TYPE_MAIN = 0;
	@cm("次卧")
	public static final Integer ROOM_TYPE_SECOND = 1;
	@cm("客卧")
	public static final Integer ROOM_TYPE_THIRD = 2;
	
	@cm("已出租")
	public final static Integer RENT_STATE_ALREADY = 0;
	@cm("未出租")
	public final static Integer RENT_STATE_NOYET = 1;
	@cm("预定")
	public final static Integer RENT_STATE_BOOK = 2;
	@cm("转租")
	public final static Integer RENT_STATE_CHANGE = 3;
	@cm("隐藏")
	public final static Integer RENT_STATE_HIDDEN = 4;
	
	private Integer id;
	
	@cm("房间名称")
	private String name;
	
	@cm("性别要求")
	private Integer sex;
	
	@cm("面积")
	private BigDecimal area;
	
	@cm("房间类型") //0.主卧  1 .次卧 2.客卧
	private Integer roomType;
	
	@cm("租金  元/月")
	private BigDecimal rentPay;
	
	@cm("押金 元")
	private BigDecimal deposite;
	
	@cm("押几") //押几 实际收费按合同收费 
	private Integer depositNum;
	
	@cm("付几 ") //付几  实际收费按合同收费 交租日期=起租日期+付几月  -提前多天 
	private Integer payNum;
	
	@cm("房间设施")
	private SubRoomConfig roomConfig;
	
	@cm("费用配置")
	private List<FeeRule> feeRules;
	
	@cm("有效合约，冗余字段")
	private Agreement agreement;
	
	@cm("出租状态")
	private Integer rentState;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public BigDecimal getArea() {
		return area;
	}

	public void setArea(BigDecimal area) {
		this.area = area;
	}

	public Integer getRoomType() {
		return roomType;
	}

	public void setRoomType(Integer roomType) {
		this.roomType = roomType;
	}

	public BigDecimal getRentPay() {
		return rentPay;
	}

	public void setRentPay(BigDecimal rentPay) {
		this.rentPay = rentPay;
	}

	public Integer getDepositNum() {
		return depositNum;
	}

	public void setDepositNum(Integer depositNum) {
		this.depositNum = depositNum;
	}

	public Integer getPayNum() {
		return payNum;
	}

	public void setPayNum(Integer payNum) {
		this.payNum = payNum;
	}

	@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
	public SubRoomConfig getRoomConfig() {
		return roomConfig;
	}

	public void setRoomConfig(SubRoomConfig roomConfig) {
		this.roomConfig = roomConfig;
	}

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public BigDecimal getDeposite() {
		return deposite;
	}

	public void setDeposite(BigDecimal deposite) {
		this.deposite = deposite;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
	public List<FeeRule> getFeeRules() {
		return feeRules;
	}

	public void setFeeRules(List<FeeRule> feeRules) {
		this.feeRules = feeRules;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	public Agreement getAgreement() {
		return agreement;
	}

	public void setAgreement(Agreement agreement) {
		this.agreement = agreement;
	}

	public Integer getRentState() {
		return rentState;
	}

	public void setRentState(Integer rentState) {
		this.rentState = rentState;
	}

}
